<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        //
        function f(stringArr, ...values) {
            let result = "";
            for (let i = 0; i < stringArr.length; i++) {
                result += stringArr[i];
                if (values[i]) {
                    result += values[i];
                }
            }
            return result;
        }
        let name = 'Mike';
        let age = 27;
        f `My Name is ${name},I am ${age+1} years old next year.`;
        // "My Name is Mike,I am 28 years old next year."
        f `My Name is ${name},I am ${age+1} years old next year.`;
        // 等价于
        f(['My Name is', ',I am ', ' years old next year.'], 'Mike', 28);
    </script>
</body>
</html>